<template>
	<view>
		<view v-if="true">
			<!-- 静态样式 -->
			<!-- 打开弹窗 -->
			<view style="padding: 200upx 15%;">
				<button type="primary" @tap="showBanner">打开弹窗</button>
			</view>
			
			<!-- 弹出层 -->
			<view  class="uni-banner" style="background:#fff;" v-if="false">
				<!-- x -->
				<view style=" text-align:right;padding:20upx;border: 1upx solid;" @tap="closeBanner">
					<text>x</text>
				</view>
				<!-- 图 -->
				<view>
					<image src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/shuijiao.jpg" mode="widthFix" style="width:100%;"></image>
				</view>
				<!-- 按钮键 -->
				<view style="margin:50upx 0; margin-bottom:68upx;" >
				    <button type='warn' style="background:#F6644D; margin:0 80upx;">一个按钮</button>
				</view>
			</view>
			
			<!-- 做黑色阴影颜色 -->
			<view class="uni-mask" v-if="bannerShow">uni-mask</view>
			<!-- <view class="uni-mask" v-if="true">uni-mask</view> -->
			<!-- 弹出层 -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bannerShow:true
			};
		},
		methods:{
			closeBanner:function(){
				this.bannerShow=false;
			},
			showBanner:function(){
				this.bannerShow=true;
			},
		},
		
		onBackPress() {
			if(this.bannerShow){
				this.bannerShow = false;
				return true;
			}
			console.log('onBackPress')
		},
	}
</script>

<style lang="scss" scoped>
	/* 弹出层形式的广告 */
	.uni-banner {
		width: 70%;
		position: fixed;
		left: 15%;
		margin-top: -800upx;
		z-index: 99;
	}
	.uni-mask{
		 z-index: 1000;
		// background: rgba(0, 0, 0, 0.6);
		background-color:rgba(0, 0, 0, 0.6);
		border: 1rpx solid #f00;
	}

</style>
